FROM ubuntu

# 设置编码
ENV LANG C.UTF-8

# 设置源
COPY source.list /etc/apt/sources.list


RUN apt-get update \
    && apt-get install  -y --no-install-recommends \
    supervisor \
    python3.5 \
    python3-pip \
    python-pip \
    python3-setuptools \
    vim

# 创建代码文件夹

# RUN mkdir /mnt

# 更新pip
#RUN pip3 install --upgrade pip


## 安装其它依赖
#ADD requirements.txt /opt/sources/extra_pip.txt
#RUN pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple -r /opt/sources/extra_pip.txt



# 添加系统用户
RUN useradd -md /odoo_home -s /bin/false odoo \
    && mkdir -p /mnt/extra-addon \
    && chown -R odoo:odoo /mnt/extra-addon \
    && mkdir -p /var/log/supervisor \
    && chown -R odoo:odoo /var/log/supervisor \
    && mkdir -p /var/lib/odoo \
    && chown -R odoo:odoo /var/lib/odoo


RUN mkdir -p /var/log/supervisor
RUN chown -R odoo:odoo /var/log/supervisor

COPY . /mnt/extra-addon/postgraduate_prediction

VOLUME ["/var/log/supervisor", "/var/lib/odoo"]

ADD ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf

EXPOSE 8000 9999 9001



COPY ./entrypoint.py /etc
RUN python3 ./etc/entrypoint.py


CMD ["/usr/bin/supervisord"]